<%@ page language="java" import="java.util.*,java.io.*,jxl.Workbook,java.text.*" pageEncoding="utf-8"%>
<%@ page import="jxl.format.Colour,jxl.format.Alignment,jxl.format.UnderlineStyle,jxl.format.VerticalAlignment,jxl.write.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>       
    <title>日监控报表导出</title>    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>  
  <body> 
  <%
     HttpSession httpSession = request.getSession();
     List<Object> UrgeListRows=new ArrayList<Object>();
     UrgeListRows=(List)httpSession.getAttribute("ListRows");
		try {
			OutputStream os = response.getOutputStream();// 取得输出流
			response.reset();// 清空输出流
			response.setHeader("Content-disposition", "attachment; filename="
					+ new String("日监控报表".getBytes("GB2312"), "8859_1")
					+ ".xls");// 设定输出文件头
			response.setContentType("application/msexcel");// 定义输出类型
			WritableWorkbook wwb = Workbook.createWorkbook(os); // 建立excel文件
			jxl.write.WritableSheet ws = null;
			ws = wwb.createSheet("日监控报表", 1);							
			WritableFont wf = new WritableFont(WritableFont.ARIAL, 12,
					WritableFont.NO_BOLD, false,
					UnderlineStyle.NO_UNDERLINE, Colour.WHITE);
			WritableCellFormat wcf = new WritableCellFormat(wf);
			wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcf.setAlignment(Alignment.CENTRE);
			wcf.setBackground(Colour.BROWN);
			wcf.setBorder(jxl.format.Border.ALL,
					jxl.format.BorderLineStyle.MEDIUM, Colour.ICE_BLUE);
			WritableFont wf1 = new WritableFont(WritableFont.ARIAL, 12,
					WritableFont.NO_BOLD, false,
					UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
			WritableCellFormat wcf1 = new WritableCellFormat(wf1);
			wcf1.setVerticalAlignment(VerticalAlignment.CENTRE);
			wcf1.setAlignment(Alignment.CENTRE);
			wcf1.setBackground(Colour.WHITE);
			wcf1.setBorder(jxl.format.Border.ALL,
					jxl.format.BorderLineStyle.MEDIUM, Colour.ICE_BLUE);
			int i = 0;
			int j = 0;
			ws.mergeCells(0, 0, 0, 1);
			ws.mergeCells(1, 0, 1, 1);
			ws.mergeCells(2, 0, 2, 1);
			ws.mergeCells(3, 0, 3, 1);
			ws.mergeCells(4, 0, 4, 1);
			ws.mergeCells(5, 0, 5, 1);
			ws.mergeCells(6, 0, 6, 1);
			ws.mergeCells(7, 0, 7, 1);
			ws.mergeCells(8, 0, 8, 1);
			ws.mergeCells(9, 0, 9, 1);
			ws.mergeCells(10, 0, 10, 1);
			ws.mergeCells(11, 0, 11, 1);
			ws.mergeCells(12, 0, 12, 1);
			ws.mergeCells(13, 0, 13, 1);
			ws.mergeCells(14, 0, 14, 1);
			ws.mergeCells(15, 0, 15, 1);
			ws.mergeCells(16, 0, 16, 1);
			ws.mergeCells(17, 0, 17, 1);			
			ws.mergeCells(18, 0, 20, 0);			
			ws.mergeCells(21, 0, 23, 0);			
			ws.mergeCells(24, 0, 41, 0);
			ws.mergeCells(42, 0, 44, 0);																																				
			ws.addCell(new Label(0, 0, "时间", wcf));
			ws.addCell(new Label(1, 0, "省份", wcf));
			ws.addCell(new Label(2, 0, "城市", wcf));
			ws.addCell(new Label(3, 0, "县域", wcf));
			ws.addCell(new Label(4, 0, "客户编码", wcf));
			ws.addCell(new Label(5, 0, "客户名称", wcf));
			ws.addCell(new Label(6, 0, "调整前采购文件名", wcf));
			ws.addCell(new Label(7, 0, "调整前销售文件名", wcf));
			ws.addCell(new Label(8, 0, "调整前库存文件名", wcf));
			ws.addCell(new Label(9, 0, "对应代表", wcf));
			ws.addCell(new Label(10, 0, "代表联系方式", wcf));
			ws.addCell(new Label(11, 0, "商业技术联系人", wcf));
			ws.addCell(new Label(12, 0, "商业技术联系电话", wcf));
			ws.addCell(new Label(13, 0, "客户属性", wcf));
			ws.addCell(new Label(14, 0, "传输方式", wcf));
			ws.addCell(new Label(15, 0, "采购传输时间", wcf));
			ws.addCell(new Label(16, 0, "销售传输时间", wcf));
			ws.addCell(new Label(17, 0, "库存传输时间", wcf));
			ws.addCell(new Label(18, 0, "数据获取情况", wcf));
			ws.addCell(new Label(18, 1, "采购", wcf));
			ws.addCell(new Label(19, 1, "销售", wcf));
			ws.addCell(new Label(20, 1, "库存", wcf));
			ws.addCell(new Label(21, 0, "数据获取状态", wcf));
			ws.addCell(new Label(21, 1, "采购", wcf));
			ws.addCell(new Label(22, 1, "销售", wcf));
			ws.addCell(new Label(23, 1, "库存", wcf));
			ws.addCell(new Label(24, 0, "文件信息", wcf));
			ws.addCell(new Label(24, 1, "原始采购条数", wcf));
			ws.addCell(new Label(25, 1, "系统采购条数", wcf));
			ws.addCell(new Label(26, 1, "差异", wcf));
			ws.addCell(new Label(27, 1, "原始采购汇总", wcf));
			ws.addCell(new Label(28, 1, "系统采购汇总", wcf));
			ws.addCell(new Label(29, 1, "差异", wcf));
			ws.addCell(new Label(30, 1, "原始销售条数", wcf));
			ws.addCell(new Label(31, 1, "系统销售条数", wcf));
			ws.addCell(new Label(32, 1, "差异", wcf));
			ws.addCell(new Label(33, 1, "原始销售汇总", wcf));
			ws.addCell(new Label(34, 1, "系统销售汇总", wcf));
			ws.addCell(new Label(35, 1, "差异", wcf));
			ws.addCell(new Label(36, 1, "原始库存条数", wcf));	
			ws.addCell(new Label(37, 1, "系统库存条数", wcf));	
			ws.addCell(new Label(38, 1, "差异", wcf));	
			ws.addCell(new Label(39, 1, "原始库存汇总", wcf));	
			ws.addCell(new Label(40, 1, "系统库存汇总", wcf));	
			ws.addCell(new Label(41, 1, "差异", wcf));	
			ws.addCell(new Label(42, 0, "数据采集期间", wcf));	
			ws.addCell(new Label(42, 1, "采购", wcf));	
			ws.addCell(new Label(43, 1, "销售", wcf));	
			ws.addCell(new Label(44, 1, "库存", wcf));
			if ((UrgeListRows!=null) || (UrgeListRows.size()==0)){                
               for(int k=0;k<UrgeListRows.size();k++){
                   String s=UrgeListRows.get(k).toString();
                   s=s.replace("]","");
                   s=s.replace("[","");
                   String[] m=s.trim().split(",");
                   if (m[44]!=null)
                       ws.addCell(new Label(0, j + i + 2, (String)m[44].trim(), wcf1));
                   else
                       ws.addCell(new Label(0, j + i + 2, "", wcf1));
                   if (m[0]!=null)
                       ws.addCell(new Label(1, j + i + 2, (String)m[0].trim(), wcf1));
                   else
                       ws.addCell(new Label(1, j + i + 2, "", wcf1));
                   if (m[1]!=null)
                       ws.addCell(new Label(2, j + i + 2, (String)m[1].trim(), wcf1));
                   else
                       ws.addCell(new Label(2, j + i + 2, "", wcf1));
                   if (m[2]!=null)
                       ws.addCell(new Label(3, j + i + 2, (String)m[2].trim(), wcf1));
                   else
                       ws.addCell(new Label(3, j + i + 2, "", wcf1));
                   if (m[3]!=null)
                       ws.addCell(new Label(4, j + i + 2, (String)m[3].trim(), wcf1));
                   else
                       ws.addCell(new Label(4, j + i + 2, "", wcf1));
                   if (m[4]!=null)
                       ws.addCell(new Label(5, j + i + 2, (String)m[4].trim(), wcf1));
                   else
                       ws.addCell(new Label(5, j + i + 2, "", wcf1));
                   if (m[5]!=null)
                       ws.addCell(new Label(6, j + i + 2, (String)m[5].trim(), wcf1));
                   else
                       ws.addCell(new Label(6, j + i + 2, "", wcf1));
                   if (m[6]!=null)
                       ws.addCell(new Label(7, j + i + 2, (String)m[6].trim(), wcf1));
                   else
                       ws.addCell(new Label(7, j + i + 2, "", wcf1));
                   if (m[7]!=null)
                       ws.addCell(new Label(8, j + i + 2, (String)m[7].trim(), wcf1));
                   else
                       ws.addCell(new Label(8, j + i + 2, "", wcf1));
                   if (m[8]!=null)
                       ws.addCell(new Label(9, j + i + 2, (String)m[8].trim(), wcf1));
                   else
                       ws.addCell(new Label(9, j + i + 2, "", wcf1));
                   if (m[9]!=null)
                       ws.addCell(new Label(10, j + i + 2, (String)m[9].trim(), wcf1));
                   else
                       ws.addCell(new Label(10, j + i + 2, "", wcf1));
                   if (m[10]!=null)
                       ws.addCell(new Label(11, j + i + 2, (String)m[10].trim(), wcf1));
                   else
                       ws.addCell(new Label(11, j + i + 2, "", wcf1));
                   if (m[11]!=null)
                       ws.addCell(new Label(12, j + i + 2, (String)m[11].trim(), wcf1));
                   else
                       ws.addCell(new Label(12, j + i + 2, "", wcf1));
                   if (m[12]!=null)
                       ws.addCell(new Label(13, j + i + 2, (String)m[12].trim(), wcf1));
                   else
                       ws.addCell(new Label(13, j + i + 2, "", wcf1));
                   if (m[13]!=null)
                       ws.addCell(new Label(14, j + i + 2, (String)m[13].trim(), wcf1));
                   else
                       ws.addCell(new Label(14, j + i + 2, "", wcf1));
                   if (m[14]!=null)
                       ws.addCell(new Label(15, j + i + 2, (String)m[14].trim(), wcf1));
                   else
                       ws.addCell(new Label(15, j + i + 2, "", wcf1));
                   if (m[15]!=null)
                       ws.addCell(new Label(16, j + i + 2, (String)m[15].trim(), wcf1));
                   else
                       ws.addCell(new Label(16, j + i + 2, "", wcf1));
                   if (m[16]!=null)
                       ws.addCell(new Label(17, j + i + 2, (String)m[16].trim(), wcf1));
                   else
                       ws.addCell(new Label(17, j + i + 2, "", wcf1));
                   if (m[17]!=null)
                       ws.addCell(new Label(18, j + i + 2, (String)m[17].trim(), wcf1));
                   else
                       ws.addCell(new Label(18, j + i + 2, "", wcf1));
                   if (m[18]!=null)
                       ws.addCell(new Label(19, j + i + 2, (String)m[18].trim(), wcf1));
                   else
                       ws.addCell(new Label(19, j + i + 2, "", wcf1));
                   if (m[19]!=null)
                       ws.addCell(new Label(20, j + i + 2, (String)m[19].trim(), wcf1));
                   else
                       ws.addCell(new Label(20, j + i + 2, "", wcf1));
                   if (m[20]!=null)
                       ws.addCell(new Label(21, j + i + 2, (String)m[20].trim(), wcf1));
                   else
                       ws.addCell(new Label(21, j + i + 2, "", wcf1));
                   if (m[21]!=null)
                       ws.addCell(new Label(22, j + i + 2, (String)m[21].trim(), wcf1));
                   else
                       ws.addCell(new Label(22, j + i + 2, "", wcf1));
                   if (m[22]!=null)
                       ws.addCell(new Label(23, j + i + 2, (String)m[22].trim(), wcf1));
                   else
                       ws.addCell(new Label(23, j + i + 2, "", wcf1));
                   if (m[23]!=null)
                       ws.addCell(new Label(24, j + i + 2, (String)m[23].trim(), wcf1));
                   else
                       ws.addCell(new Label(24, j + i + 2, "", wcf1));
                   if (m[24]!=null)
                       ws.addCell(new Label(25, j + i + 2, (String)m[24].trim(), wcf1));
                   else
                       ws.addCell(new Label(25, j + i + 2, "", wcf1));
                   if (m[25]!=null)
                       ws.addCell(new Label(26, j + i + 2, (String)m[25].trim(), wcf1));
                   else
                       ws.addCell(new Label(26, j + i + 2, "", wcf1));
                   if (m[26]!=null)
                       ws.addCell(new Label(27, j + i + 2, (String)m[26].trim(), wcf1));
                   else
                       ws.addCell(new Label(27, j + i + 2, "", wcf1));
                   if (m[27]!=null)
                       ws.addCell(new Label(28, j + i + 2, (String)m[27].trim(), wcf1));
                   else
                       ws.addCell(new Label(28, j + i + 2, "", wcf1));
                   if (m[28]!=null)
                       ws.addCell(new Label(29, j + i + 2, (String)m[28].trim(), wcf1));
                   else
                       ws.addCell(new Label(29, j + i + 2, "", wcf1));
                   if (m[29]!=null)
                       ws.addCell(new Label(30, j + i + 2, (String)m[29].trim(), wcf1));
                   else
                       ws.addCell(new Label(30, j + i + 2, "", wcf1));
                   if (m[30]!=null)
                       ws.addCell(new Label(31, j + i + 2, (String)m[30].trim(), wcf1));
                   else
                       ws.addCell(new Label(31, j + i + 2, "", wcf1));
                   if (m[31]!=null)
                       ws.addCell(new Label(32, j + i + 2, (String)m[31].trim(), wcf1));
                   else
                       ws.addCell(new Label(32, j + i + 2, "", wcf1));
                   if (m[32]!=null)
                       ws.addCell(new Label(33, j + i + 2, (String)m[32].trim(), wcf1));
                   else
                       ws.addCell(new Label(33, j + i + 2, "", wcf1));
                   if (m[33]!=null)
                       ws.addCell(new Label(34, j + i + 2, (String)m[33].trim(), wcf1));
                   else
                       ws.addCell(new Label(34, j + i + 2, "", wcf1));
                   if (m[34]!=null)
                       ws.addCell(new Label(35, j + i + 2, (String)m[34].trim(), wcf1));
                   else
                       ws.addCell(new Label(35, j + i + 2, "", wcf1));
                   if (m[35]!=null)
                       ws.addCell(new Label(36, j + i + 2, (String)m[35].trim(), wcf1));
                   else
                       ws.addCell(new Label(36, j + i + 2, "", wcf1));   
                   if (m[36]!=null)
                       ws.addCell(new Label(37, j + i + 2, (String)m[36].trim(), wcf1));
                   else
                       ws.addCell(new Label(37, j + i + 2, "", wcf1));
                   if (m[37]!=null)
                       ws.addCell(new Label(38, j + i + 2, (String)m[37].trim(), wcf1));
                   else
                       ws.addCell(new Label(38, j + i + 2, "", wcf1));
                   if (m[38]!=null)
                       ws.addCell(new Label(39, j + i + 2, (String)m[38].trim(), wcf1));
                   else
                       ws.addCell(new Label(39, j + i + 2, "", wcf1));   
                   if (m[39]!=null)
                       ws.addCell(new Label(40, j + i + 2, (String)m[39].trim(), wcf1));
                   else
                       ws.addCell(new Label(40, j + i + 2, "", wcf1));
                   if (m[40]!=null)
                       ws.addCell(new Label(41, j + i + 2, (String)m[40].trim(), wcf1));
                   else
                       ws.addCell(new Label(41, j + i + 2, "", wcf1));
                   if (m[41]!=null)
                       ws.addCell(new Label(42, j + i + 2, (String)m[41].trim(), wcf1));
                   else
                       ws.addCell(new Label(42, j + i + 2, "", wcf1));
                   if (m[42]!=null)
                       ws.addCell(new Label(43, j + i + 2, (String)m[42].trim(), wcf1));
                   else
                       ws.addCell(new Label(43, j + i + 2, "", wcf1));  
                   if (m[43]!=null)
                       ws.addCell(new Label(44, j + i + 2, (String)m[43].trim(), wcf1));
                   else
                       ws.addCell(new Label(44, j + i + 2, "", wcf1)); 
                   i++;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
               }
            }
			wwb.write();
			wwb.close();
			os.flush();
			os.close();			
		} catch (Exception e) {// 第一层循环
			e.printStackTrace();
		}                       
  %>
  </body>
</html>
